package uk.co.hs.domain.web;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Index;

import uk.co.hs.domain.generic.UtilisoftGenericDomain;

/**
 * WebForwarding.
 */
@Entity
@org.hibernate.annotations.Table(appliesTo=WebForwarding.TABLE_NAME,
                                 indexes={@Index(name=WebForwarding.TABLE_NAME + "_IDX_1", columnNames={UtilisoftGenericDomain.PK, UtilisoftGenericDomain.VERSION}),
                                          @Index(name=WebForwarding.TABLE_NAME + "_IDX_2", columnNames=WebForwarding.USER_FK),
                                          @Index(name=WebForwarding.TABLE_NAME + "_IDX_3", columnNames=WebForwarding.URL_FK)})
@Table(name=WebForwarding.TABLE_NAME)
public class WebForwarding extends UtilisoftGenericDomain<Long>
{
  private static final long serialVersionUID = 1L;

  protected static final String TABLE_NAME = "WEB_FORWARDING";
  protected static final String USER_FK = "USER_FK";
  protected static final String URL_FK = "URL_FK";

  private WebUser mWebUser;
  private WebUrl mWebUrl;

  /**
   * @return the webUser
   */

  @ManyToOne
  @JoinColumn(name=USER_FK)
  @NotNull
  @ForeignKey(name="WEB_FORWARDING_TO_WEB_USER")
  public WebUser getWebUser()
  {
    return mWebUser;
  }

  /**
   * @param aWebUser the webUser to set
   */
  public void setWebUser(WebUser aWebUser)
  {
    mWebUser = aWebUser;
  }

  /**
   * @return the webUrl
   */
  @ManyToOne
  @JoinColumn(name=URL_FK)
  @NotNull
  @ForeignKey(name="WEB_FORWARDING_TO_WEB_URL")
  public WebUrl getWebUrl()
  {
    return mWebUrl;
  }

  /**
   * @param aWebUrl the webUrl to set
   */
  public void setWebUrl(WebUrl aWebUrl)
  {
    mWebUrl = aWebUrl;
  }

}
